#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>

using namespace std;

class Solution
{
public:
    bool containsDuplicate(vector<int>& nums)
    {
        unordered_set<int> hash;
        for (int i = 0; i < nums.size(); i++)
        {
            if (hash.count(nums[i])) return true;
            hash.insert(nums[i]);
        }
        return false;
    }
};

class Solution
{
public:
    bool containsDuplicate(vector<int>& nums)
    {
        unordered_map<int, int> hash;
        for (int i = 0; i < nums.size(); i++)
        {
            if (hash.count(nums[i])) return true;
            hash[nums[i]] = i;
        }
        return false;
    }
};